
class DataNode
{
public:
    typedef unordered_map<string,DataNode> ChildNodeContainer ;


    const string& get_data() 
    {
        return m_data ;
    }

    void set_data(const string& data)
    {
        m_data = data ;
    }

    void set_child(const string& key,const DataNode& node)
    {
        m_child[key] = node ;
    }

    int child_count()
    {
        return m_child.size() ;
    }

    DataNode* get_child(const string& key)    
    {
        ChildNodeContainer::iterator it = m_child.find(key) ;
        if( it != m_child.end() ) return it->second ;
        return NULL ;
    }

private:
    string m_data ;
    ChildNodeContainer m_child ;
} ;


class Client
{
public:
    int set(const string& path,const string& data) ;
    const string& get(const string& path) ;
    
    //get multiple data
    map<string,string> mget(const vector<string>& path_list) ;
    
    // get child and data
    map<string,string> get_child(const string& path) ;

} ;

void test()
{
    client.set("a.b.c1","10") ;
    client.set("a.b.c2","12") ;
    DataNode* node = client.get("a.b") ;
    assert(node->get_child("c1")->get_data() == "10") ;
    assert(node->get_child("c2")->get_data() == "12") ;

}

